home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / network / mail / pathalia.zoo / src / parse.c < prev    next >
C/C++ Source or Header  |  1991-01-12  |  28KB  |  1,052 lines

  1. #ifndef lint
  2. char yysccsid[] = "@(#)yaccpar    1.4 (Berkeley) 02/25/90";
  3. #endif
  4. #line 2 "parse.y"
  5. /* pathalias -- by steve bellovin, as told to peter honeyman */
  6. #ifndef lint
  7. static char    *sccsid = "@(#)parse.y    9.10 88/09/07";
  8. #endif /* lint */
  9.  
  10. #include "def.h"
  11.  
  12. /* scanner states (yylex, parse) */
  13. #define OTHER        0
  14. #define COSTING        1
  15. #define NEWLINE        2
  16. #define FILENAME    3
  17.  
  18. /* exports */
  19. long Tcount;
  20. extern void yyerror();
  21.  
  22. /* imports */
  23. extern node *addnode(), *addprivate();
  24. extern void fixprivate(), alias(), deadlink(), deletelink();
  25. extern link *addlink();
  26. extern int strcmp();
  27. extern char *strsave();
  28. extern int optind;
  29. extern char *Cfile, *Netchars, **Argv;
  30. extern int Lineno, Argc;
  31.  
  32. /* privates */
  33. STATIC void fixnet(), adjust();
  34. STATIC int yylex(), yywrap(), getword();
  35. static int Scanstate = NEWLINE;    /* scanner (yylex) state */
  36. int Donelast = 0;    /* we're all out of files to parse */
  37.  
  38. /* flags for ys_flags */
  39. #define TERMINAL 1
  40. #line 39 "parse.y"
  41. typedef union {
  42.     node    *y_node;
  43.     Cost    y_cost;
  44.     char    y_net;
  45.     char    *y_name;
  46.     struct {
  47.         node *ys_node;
  48.         Cost ys_cost;
  49.         short ys_flag;
  50.         char ys_net;
  51.         char ys_dir;
  52.     } y_s;
  53. } YYSTYPE;
  54. #line 55 "y_tab.c"
  55. #define SITE 257
  56. #define HOST 258
  57. #define STRING 259
  58. #define COST 260
  59. #define NET 261
  60. #define EOL 262
  61. #define PRIVATE 263
  62. #define DEAD 264
  63. #define DELETE 265
  64. #define FILETOK 266
  65. #define ADJUST 267
  66. #define YYERRCODE 256
  67. short yylhs[] = {                                        -1,
  68.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  69.     0,    3,    3,    3,    8,    8,    8,    8,    8,    8,
  70.     1,    1,    1,    2,    2,    4,    4,    4,    6,    6,
  71.     6,    9,    9,    7,    7,    7,   15,   15,    5,    5,
  72.     5,   16,   12,   12,   12,   11,   11,   10,   17,   20,
  73.    20,   20,   21,   21,   22,   23,   18,   19,   24,   24,
  74.    24,   25,   13,   26,   27,   13,   14,   14,   14,   14,
  75.    14,   14,   14,
  76. };
  77. short yylen[] = {                                         2,
  78.     0,    2,    3,    3,    3,    3,    3,    3,    3,    3,
  79.     2,    3,    4,    2,    1,    1,    1,    1,    1,    1,
  80.     1,    2,    2,    1,    3,    3,    3,    2,    5,    6,
  81.     6,    1,    2,    1,    3,    2,    4,    3,    1,    3,
  82.     2,    4,    1,    3,    2,    1,    3,    1,    4,    1,
  83.     3,    2,    1,    3,    0,    0,    6,    4,    1,    3,
  84.     2,    2,    0,    0,    0,    5,    1,    2,    3,    3,
  85.     3,    3,    3,
  86. };
  87. short yydefred[] = {                                      0,
  88.     0,    0,   11,   15,    2,    0,    0,    0,    0,    0,
  89.    32,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  90.     0,    0,    0,    0,   55,    0,    3,    0,    4,    0,
  91.     5,   24,    0,    0,    0,    0,    0,    0,    0,    6,
  92.     7,    8,    9,   10,   39,   38,    0,    0,    0,   43,
  93.     0,    0,    0,    0,   50,    0,   48,    0,    0,   59,
  94.     0,   27,   22,    0,   26,   64,   12,   23,    0,   34,
  95.     0,    0,   37,    0,    0,   42,    0,    0,   49,   56,
  96.    62,    0,   58,   13,   25,    0,    0,    0,    0,   40,
  97.    47,   44,   54,   51,    0,   60,   67,    0,    0,    0,
  98.     0,   35,    0,   29,   57,    0,    0,    0,    0,    0,
  99.     0,    0,   30,   31,   69,    0,    0,   72,   73,   66,
  100. };
  101. short yydgoto[] = {                                       2,
  102.    36,   37,   12,   13,   47,   14,   71,   15,   16,   49,
  103.    50,   51,   67,  100,   17,   18,   19,   20,   21,   54,
  104.    55,   56,   95,   59,   60,   86,  112,
  105. };
  106. short yysindex[] = {                                   -234,
  107.  -237,  -55,    0,    0,    0,  -96,  -93,  -78,  -74,  -72,
  108.     0,  -41,  -36, -204,  -44, -109, -202, -178, -177, -176,
  109.  -175, -104, -168, -167,    0, -166,    0,  -14,    0, -165,
  110.     0,    0,  -51, -164, -163,   59, -161,   -5, -154,    0,
  111.     0,    0,    0,    0,    0,    0,  -21,    0, -153,    0,
  112.   -20,    0, -150,  -18,    0, -142,    0,   59,  -16,    0,
  113.    59,    0,    0,   57,    0,    0,    0,    0, -154,    0,
  114.   -15, -137,    0, -166, -168,    0, -166, -167,    0,    0,
  115.     0, -166,    0,    0,    0,  -35,  -13, -135,  -38,    0,
  116.     0,    0,    0,    0,   -2,    0,    0,  -35,  -35,   14,
  117.    59,    0,   59,    0,    0,   28,   26,  -35,  -35,  -35,
  118.   -35,   83,    0,    0,    0,   28,   28,    0,    0,    0,
  119. };
  120. short yyrindex[] = {                                      1,
  121.     0,    0,    0,    0,    0,  -42,  -24,  -22,  -19,  -17,
  122.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  123.     0,    0,    0,    0,    0,    0,    0,  -33,    0,  -32,
  124.     0,    0,    0,    0, -103,  -31,  -40,    0,    0,    0,
  125.     0,    0,    0,    0,    0,    0,    0,  -37,    0,    0,
  126.     0,  -29,    0,    0,    0,    0,    0,  -12,    0,    0,
  127.   -31,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  128.     0,  -11,    0,    0,  -10,    0,    0,   -9,    0,    0,
  129.     0,   -4,    0,    0,    0,    0,    0,    3, -136,    0,
  130.     0,    0,    0,    0,    0,    0,    0,    0,    0,   84,
  131.  -136,    0, -136,    0,    0,   31,    0,    0,    0,    0,
  132.     0,    0,    0,    0,    0,   36,   37,    0,    0,    0,
  133. };
  134. short yygindex[] = {                                      0,
  135.    99,   96,    0,    0,    0,    0,   61,    0,    0,   24,
  136.    56,    0,   -6,  -45,    0,    0,    0,    0,    0,    0,
  137.    54,    0,    0,    0,   51,    0,    0,
  138. };
  139. #define YYTABLESIZE 268
  140. short yytable[] = {                                      21,
  141.     1,   66,   28,   21,   99,   11,   46,   30,   34,   98,
  142.    14,   28,   63,   39,   53,   34,   35,   16,   16,   33,
  143.    46,    1,   72,   75,    3,   78,   22,   82,   88,   23,
  144.    88,   63,   41,   45,   52,   17,   17,   18,   18,   61,
  145.    19,   19,   20,   20,   24,   34,   36,   53,   25,   58,
  146.    26,   81,  106,  107,   84,  110,  108,   31,  109,   40,
  147.   111,    1,  116,  117,  118,  119,  115,  110,  108,  110,
  148.   109,   68,  111,   68,  111,   68,   70,   71,   70,   71,
  149.    70,   71,  104,   41,   42,   43,   44,   46,   48,   52,
  150.    57,   62,   64,   65,  113,   53,  114,   91,   66,   68,
  151.    93,   53,   70,   73,   76,   58,   79,   74,   83,   89,
  152.    77,  101,   63,   41,   45,   52,   80,   69,   85,   90,
  153.    61,  102,  105,  120,   65,   63,   61,   36,   63,   87,
  154.    92,   94,   96,    0,    0,    0,    0,    0,    0,    0,
  155.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  156.     0,   38,   45,    0,    0,    0,    0,   33,    0,    0,
  157.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  158.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  159.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  160.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  161.     0,    0,    4,    0,    0,   32,    5,    6,    7,    8,
  162.     9,   10,   32,    0,   16,    0,   33,    0,   16,    0,
  163.    27,   21,  103,   48,   97,   29,    0,    0,   14,   28,
  164.    63,   48,   17,    0,   18,    0,   17,   19,   18,   20,
  165.     0,   19,   32,   20,    0,    0,   33,    0,    0,    0,
  166.     0,    0,    0,    0,    0,    0,    0,    0,    1,    0,
  167.     0,    0,    1,    1,    1,    1,    1,    1,
  168. };
  169. short yycheck[] = {                                      40,
  170.     0,   40,   44,   44,   40,   61,   44,   44,   60,   45,
  171.    44,   44,   44,  123,   44,   60,   61,   60,   61,  123,
  172.   125,  256,   44,   44,  262,   44,  123,   44,   44,  123,
  173.    44,   44,   44,   44,   44,   60,   61,   60,   61,   44,
  174.    60,   61,   60,   61,  123,   60,   44,   24,  123,   26,
  175.   123,   58,   98,   99,   61,   42,   43,  262,   45,  262,
  176.    47,   61,  108,  109,  110,  111,   41,   42,   43,   42,
  177.    45,   41,   47,   43,   47,   45,   41,   41,   43,   43,
  178.    45,   45,   89,  262,  262,  262,  262,  125,  257,  257,
  179.   257,  257,  257,  257,  101,  125,  103,   74,   40,  261,
  180.    77,   78,  257,  125,  125,   82,  125,  261,  125,  125,
  181.   261,  125,  125,  125,  125,  125,  259,  123,   62,  257,
  182.   125,  257,  125,   41,   41,  262,   28,  125,   33,   69,
  183.    75,   78,   82,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
  184.    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
  185.    -1,  261,  257,   -1,   -1,   -1,   -1,  261,   -1,   -1,
  186.    -